package com.scuec.tourismwebsite.controller;

import com.github.pagehelper.PageInfo;
import com.scuec.tourismwebsite.service.AttractionPopularityService;
import com.scuec.tourismwebsite.vo.OrderUserBoutique;
import com.scuec.tourismwebsite.vo.PopularityAttraction;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
//1
@RestController
@CrossOrigin
@RequestMapping("tour/v1")
public class AttractionPopularityController {

    @Autowired
    private AttractionPopularityService attractionPopularityService;

    @DeleteMapping("attraction/popularity/{popularity_id}")
    public int deleteAttractionPopularityById(@PathVariable Integer popularity_id) {
        return attractionPopularityService.deleteAttractionPopularityById(popularity_id);
    }

    @GetMapping("popularitypages")
    public PageInfo<PopularityAttraction> findPopularityPages(@RequestParam Integer pageNum,@RequestParam Integer pageSize){
        PageInfo<PopularityAttraction> pageInfo=attractionPopularityService.findPopularityPages(pageNum,pageSize);
        return pageInfo;
    };

    @GetMapping("popularitypage")
    public PageInfo<PopularityAttraction> findPopularityPage(String attraction_name, Integer pageNum, Integer pageSize){
        PageInfo<PopularityAttraction> pageInfo=attractionPopularityService.findPopularityPage(attraction_name,pageNum,pageSize);
        return pageInfo;
    };

    @GetMapping("attraction/popularity")
    public List<PopularityAttraction> getAllAttractionPopularity() {
        return attractionPopularityService.getAllAttractionPopularity();
    }




}


